#define _CRT_SECURE_NO_WARNINGS 1
#include <iostream>
#define MAXSIZE 1000
using namespace std;

typedef struct
{
    int key;
    char* otherinfo;
} ElemType;

typedef struct
{
    ElemType* r;
    int length;
} SqList;

int Partition(SqList& L, int low, int high)
{
    int pivotkey;
    L.r[0] = L.r[low];
    pivotkey = L.r[low].key;

    while (low < high)
    {
        while (low < high && L.r[high].key >= pivotkey) --high;
        L.r[low] = L.r[high];
        while (low < high && L.r[low].key <= pivotkey) ++low;
        L.r[high] = L.r[low];
    }
    L.r[low] = L.r[0];
    return low;
}

void QSort(SqList& L, int low, int high)
{
    int pivotloc;
    if (low < high)
    {
        pivotloc = Partition(L, low, high);
        QSort(L, low, pivotloc - 1);
        QSort(L, pivotloc + 1, high);
    }
}

void QuickSort(SqList& L)
{
    QSort(L, 1, L.length);
}

void Create_Sq(SqList& L)
{
    int i, n;
    cin >> n; // Input size not greater than MAXSIZE
    for (i = 1; i <= n; i++)
    {
        cin >> L.r[i].key;
        L.length++;
    }
}

void show(SqList L)
{
    int i;
    for (i = 1; i <= L.length; i++)
        if (i == 1)
            cout << L.r[i].key;
        else
            cout << " " << L.r[i].key;
}

int main()
{
    SqList L;
    L.r = new ElemType[MAXSIZE + 1];
    L.length = 0;
    Create_Sq(L);
    QuickSort(L);
    show(L);
    delete[] L.r; // Clean up memory
    return 0;
}
